<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Team extends CI_Controller {
    
	function __construct() 
	{
		parent::__construct();
                $this->load->model('login');
                $this->load->model('dbase');
	}
        
        function index($teamid = '0')
        {
            if($teamid == '0')
            {
                echo 'You must specify a team.';
            } else {
                //$this->dbase->
            }
        }
        
        function admin($teamid = '0')
        {
            $sessions = $this->login->session_Check();
            $user_id = $sessions['id'];
                
            if ($sessions == FALSE)
            {
                $this->load->model('steamopenid');
                $data_user = array();
                $data_user['logged_in'] = FALSE;
                $data_user['steam_login_link'] = $this->steamopenid->genUrl("http://acdervis.dotaiki.com/acd/?returning=1");
            } else {
                $data_user = array(
                    'logged_in' => TRUE,
                    'nickname' => $sessions['nickname'],
                    'avatar' => $sessions['avatar'],
                );
            }
            
            if($teamid == '0')
            {
                echo 'You have not selected a team to manage.';
            } else if(!$this->dbase->team_admin_check($teamid, $user_id))
            {
                echo 'You are not authorized to manage this team.';
            } else {
                echo 'Welcome, stranger.';
            }
        }
}

/* End of file team.php */
/* Location: ./application/controllers/team.php */
